// eslint-disable-next-line
import {
  UserLayout,
  BasicLayout
  // BlankLayout
} from '@/layouts'
import {
  bxAnaalyse
} from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: (h) => h('router-view')
}

export const asyncRouterMap = [

  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: {
      title: '首页'
    },
    redirect: '/admin',
    children: [
      // 系统后台
      {
        path: 'admin',
        name: 'index',
        component: () => import('@/views/dashboard/Analysis'),
        meta: {
          title: '控制台',
          keepAlive: true,
          icon: bxAnaalyse,
          permission: ['adminDashboard']
        }
      },
      {
        path: '/admin/examine',
        name: 'examine',
        redirect: '/admin/examine/add',
        component: RouteView,
        meta: { title: '审核账号', keepAlive: true, icon: bxAnaalyse, permission: ['adminDashboard'] },
        children: [
          {
            path: 'add',
            name: 'examine-add',
            component: () => import('@/views/admin/examineAdd'),
            meta: { title: '新增账号', keepAlive: false, permission: ['adminDashboard'] }
          }
        ]
      },
      {
        path: '/admin/article',
        name: 'article',
        redirect: '/admin/article/class',
        component: RouteView,
        meta: { title: '文章管理', keepAlive: true, icon: bxAnaalyse, permission: ['adminDashboard'] },
        children: [
          {
            path: 'class',
            name: 'article-class',
            component: () => import('@/views/article/class'),
            meta: {
              title: '分类管理',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'content',
            name: 'article-content',
            component: () => import('@/views/article/content'),
            meta: {
              title: '文章列表',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'addarticle',
            hidden: true, // 隐藏路由
            name: 'article-addarticle',
            component: () => import('@/views/article/addarticle.vue'),
            meta: {
              title: '编辑文章',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          }
        ]
      },
      {
        path: '/admin/permission',
        name: 'permission',
        redirect: '/admin/permission/permission',
        component: RouteView,
        meta: { title: '权限管理', keepAlive: true, icon: bxAnaalyse, permission: ['adminDashboard'] },
        children: [
          {
            path: 'permission',
            name: 'permission-permission',
            component: () => import('@/views/permission/permission'),
            meta: {
              title: '权限列表',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'newpermission',
            name: 'permission-newpermission',
            component: () => import('@/views/permission/newpermission'),
            meta: {
              title: '新权限列表',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'role',
            name: 'permission-role',
            component: () => import('@/views/permission/role'),
            meta: {
              title: '角色列表',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'newrole',
            name: 'permission-newrole',
            component: () => import('@/views/permission/newrole'),
            meta: {
              title: '新角色列表',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'permiss',
            name: 'permission-permiss',
            component: () => import('@/views/permission/userpermiss'),
            meta: {
              title: '用户列表',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          }
        ]
      },
      {
        path: '/admin/settings',
        name: 'settings',
        redirect: '/admin/settings/activity',
        component: RouteView,
        meta: { title: '系统设置', keepAlive: true, icon: bxAnaalyse, permission: ['adminDashboard'] },
        children: [
          {
            path: 'activity',
            name: 'settings-activity',
            component: () => import('@/views/settings/activity'),
            meta: {
              title: '营销活动',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'grade',
            name: 'settings-grade',
            component: () => import('@/views/settings/grade'),
            meta: {
              title: '用户等级',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'high-brand',
            name: 'settings-high-brand',
            component: () => import('@/views/settings/highbrand'),
            meta: {
              title: '优质品牌',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'business',
            name: 'settings-business',
            component: () => import('@/views/settings/business'),
            meta: {
              title: '商家信息墙',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'banner',
            name: 'settings-banner',
            component: () => import('@/views/settings/banner'),
            meta: {
              title: 'banner设置',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'cdrlibrary',
            name: 'settings-cdrlibrary',
            component: () => import('@/views/settings/cdrlibrary.vue'),
            meta: {
              title: '素材库',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'cooperation',
            name: 'settings-cooperation',
            component: () => import('@/views/settings/cooperation.vue'),
            meta: {
              title: '商家合作榜',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'integral',
            name: 'settings-integral',
            component: () => import('@/views/settings/integral.vue'),
            meta: {
              title: '用户积分设置',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'systemlog',
            name: 'settings-systemlog',
            component: () => import('@/views/settings/systemlog.vue'),
            meta: {
              title: '系统更新日志',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
           {
            path: 'addlog',
            hidden: true, // 隐藏路由
            name: 'article-addlog',
            component: () => import('@/views/settings/addlog.vue'),
            meta: {
              title: '编辑日志',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          }
        ]
      },
      // 商品管理
      {
        path: '/admin/auditgoods',
        name: 'goods',
        redirect: '/admin/auditgoods/examine',
        component: RouteView,
        meta: { title: '商品管理', keepAlive: true, icon: bxAnaalyse, permission: ['adminDashboard'] },
        children: [
          {
            path: 'examine',
            name: 'goods-examine',
            component: () => import('@/views/auditgoods/examine'),
            meta: {
              title: '审核商品',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'list',
            name: 'goods-list',
            component: () => import('@/views/auditgoods/goodslist'),
            meta: {
              title: '商品列表',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          },
          {
            path: 'mycollect',
            name: 'goods-mycollect',
            component: () => import('@/views/auditgoods/mycollect'),
            meta: {
              title: '我的收藏',
              keepAlive: false,
              permission: ['adminDashboard']
            }
          }
        ]
      },
      // 用户后台
      {
        path: '/admin',
        name: '/index',
        component: () => import('@/views/userindex/index'),
        meta: {
          title: '首页',
          keepAlive: true,
          icon: bxAnaalyse,
          permission: ['dashboard']
        }
      },
      {
        path: '/admin/goods',
        name: 'goods',
        redirect: '/admin/goods/add',
        component: RouteView,
        meta: { title: '内容管理', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
        children: [
          {
            path: 'add',
            name: 'goods-add',
            component: () => import('@/views/goods/add'),
            meta: {
              title: '发布新品',
              keepAlive: false,
              permission: ['dashboard']
            }
          },
          // 外部链接
          {
            path: 'order',
            name: 'goods-order',
            component: () => import('@/views/goods/order'),
            meta: {
              title: '商品管理',
              keepAlive: true,
              permission: ['dashboard']
            }
          }
        ]
      },
      {
        path: '/admin/stat',
        name: 'stat',
        redirect: '/admin/stat/order',
        component: RouteView,
        meta: { title: '数据中心', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
        children: [
          {
            path: 'order',
            name: 'stat',
            component: () => import('@/views/stat/order'),
            meta: {
              title: '放单数据',
              keepAlive: false,
              permission: ['dashboard']
            }
          },
          // 外部链接
          {
            path: 'personal',
            name: 'personal',
            component: () => import('@/views/stat/personal'),
            meta: {
              title: '个人榜单',
              keepAlive: true,
              permission: ['dashboard']
            }
          }
        ]
      },
      {
        path: '/admin/coin',
        name: 'coin',
        redirect: '/admin/coin/recharge',
        component: RouteView,
        meta: { title: '我的点券', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
        children: [
          {
            path: 'recharge',
            name: 'coin-recharge',
            component: () => import('@/views/coin/recharge'),
            meta: {
              title: '充值点券',
              keepAlive: false,
              permission: ['dashboard']
            }
          },
          // 外部链接
          {
            path: 'log',
            name: 'coin-log',
            component: () => import('@/views/coin/log'),
            meta: {
              title: '点券记录',
              keepAlive: true,
              permission: ['dashboard']
            }
          }
        ]
      },
      {
        path: '/admin/msgs',
        name: 'msgs',
        redirect: '/admin/msgs/feedback',
        component: RouteView,
        meta: { title: '消息中心', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
        children: [
          {
            path: 'feedback',
            name: 'msgs-feedback',
            component: () => import('@/views/msgs/feedback'),
            meta: {
              title: '反馈和评论',
              keepAlive: false,
              permission: ['dashboard']
            }
          },
          // 外部链接
          {
            path: 'sys',
            name: 'msgs-sys',
            component: () => import('@/views/msgs/sys'),
            meta: {
              title: '系统通知',
              keepAlive: true,
              permission: ['dashboard']
            }
          }
        ]
      },
      {
        path: '/admin/content',
        name: 'media',
        redirect: 'set',
        component: RouteView,
        meta: { title: '账号管理', keepAlive: true, icon: bxAnaalyse, permission: ['dashboard'] },
        children: [
          {
            path: 'set',
            name: 'media',
            component: () => import('@/views/content/set'),
            meta: {
              title: '资料设置',
              keepAlive: false,
              permission: ['dashboard']
            }
          },
          // 外部链接
          {
            path: 'security',
            name: 'security',
            component: () => import('@/views/content/security'),
            meta: {
              title: '账号安全',
              keepAlive: true,
              permission: ['dashboard']
            }
          }
        ]
      }
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [{
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [{
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'register',
        name: 'register',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      },
      {
        path: 'register-result',
        name: 'registerResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RegisterResult')
      },
      {
        path: 'recover',
        name: 'recover',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Recover')
      },
      {
        path: 'recover-result',
        name: 'recoverResult',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/RecoverResult')
      }
    ]
  },
  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }

]
